//
//  HeadderView.m
//  OrderFood
//
//  Created by xiaofang wang on 2018/10/23.
//  Copyright © 2018年 zhiyuan. All rights reserved.
//

#import "HeadderView.h"
@interface HeadderView()
@property(nonatomic,strong)UIImageView *timeImg;
@property(nonatomic,strong)UILabel *timeLb;
@property(nonatomic,strong)UILabel *priceLb;
@property(nonatomic,strong)UIView *contentView;
@end
@implementation HeadderView

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = BACKGROUNDCOLOR;
        [self setupUI];
    }
    return self;
}

-(void)setupUI{
    self.contentView = [[UIView alloc] initWithFrame:CGRectMake(0, 10, GetWidth(self), GetHeight(self)-10)];
    self.contentView.backgroundColor = WHITECOLOR;
    [self addSubview:self.contentView];
    self.timeImg = [[UIImageView alloc] initWithFrame:CGRectMake(15, 11.5, 17, 17)];
    self.timeLb = [[UILabel alloc] initWithFrame:CGRectMake(GetMaxX(self.timeImg)+5, 0, 120, GetHeight(self.contentView))];
    self.priceLb = [[UILabel alloc] initWithFrame:CGRectMake(GetMaxX(self)-115, 0, 100, GetHeight(self.contentView))];
    [self.contentView addSubview:self.timeImg];
    [self.contentView addSubview:self.timeLb];
    [self.contentView addSubview:self.priceLb];
    
    
    self.timeImg.image = IMAGE(@"naoz");
    self.timeLb.font = FONT(14);
//    NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"要求12：58送达"];
//    NSRange range1 = [[str string] rangeOfString:];
//    [str addAttribute:NSForegroundColorAttributeName value:themeColor range:range1];
    self.timeLb.attributedText = [QTTools getStrWithAllStr:@"要求12：58送达" rangeStr:@"12：58" color:themeColor font:14];
    self.priceLb.font = BFONT(20);
    self.priceLb.textColor = themeColor;
    self.priceLb.textAlignment = NSTextAlignmentRight;
    self.priceLb.text = @"￥9.0";
    
//    self.timeImg.sd_layout.leftSpaceToView(self, 15).topSpaceToView(self.contentView, 11.5).widthIs(17).heightIs(17);
//    self.timeLb.sd_layout.leftSpaceToView(self.timeImg, 5).topEqualToView(self.contentView).widthIs(120).heightRatioToView(self, 1);
//    self.priceLb.sd_layout.rightSpaceToView(self, 15).topEqualToView(self.contentView).widthIs(100).heightRatioToView(self, 1);
    
    
}

-(void)setOrderModel:(OrderModel *)orderModel {
    self.priceLb.text = [NSString stringWithFormat:@"%@", orderModel.deliveryCommission];
    
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
